package com.meisupic.copyright.notify;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Component;

/**
 * 通知参数,可以由配置notify.xml来修改参数
 *
 * @author 蓝健
 */
@Component
public class NotifyParam {

  private Map<Integer, Integer> notifyParams;// 通知时间次数map
  private String successValue;// 通知后用于判断是否成功的返回值。由HttpResponse获取

  public Map<Integer, Integer> getNotifyParams() {
    return notifyParams;
  }

  @PostConstruct
  public void init() {
    notifyParams = new HashMap<>();
    notifyParams.put(1, 0);
    notifyParams.put(2, 5);
    notifyParams.put(3, 10);
    notifyParams.put(4, 60);
    notifyParams.put(5, 60 * 24);
  }

  public String getSuccessValue() {
    return successValue;
  }

  public void setSuccessValue(String successValue) {
    this.successValue = successValue;
  }

  public Integer getMaxNotifyTime() {
    return notifyParams == null ? 0 : notifyParams.size();
  }

}
